/**
  *****************************************************************************
  * @file 
  * @brief 
  * @author Evan
  * @version V1.0.0
  * @date 2023/10/14
  *****************************************************************************
  */
#ifndef __DEV_BAG302_H__
#define __DEV_BAG302_H__

/* Public include -----------------------------------------------------------*/
#include "dev_include.h"
/* Public defines -----------------------------------------------------------*/
typedef struct
{
    double  P_sensor;        //传感器压力值，单位Pa(1bar = 100000Pa)
	uint8_t status;        //通信状态（1：成功， 0：失败）
    uint8_t igsta;          //IG状态
} bag302val_t;


/* Public enum -----------------------------------------------------------*/
typedef enum
{
    BAGREAD_PRE = 0,   //读取压力
    BAGTURN_IG,        //打开/关闭IG
    BAGREAD_IGONOFF,   //读取IG开关状态
    BAGREAD_IGMODULE,  //读取IG模块状态
    BAGREAD_SW,        //读取版本号
    BAG_RST,           //模块重启
    
} bag302cmd_e;//命令列表

typedef enum
{
    IG_ST_OK = 0,   //状态正常
    IG_OVPRS,       //过压
    IG_EMISS,       //放射
    IG_POWER,       //
    IG_ION_C,       //离子电流
    
} bag302igmodule_e;//IG模块状态列表
///* Public Struct -----------------------------------------------------------*/
//typedef struct dev_bag302  dev_bag302_t;


//struct dev_bag302
//{
//    /* ***************Public Parameter  *************** */
//	const char *            Drv_Num;
//    const char *            Tx_Pin;
//    const char *            Rx_Pin;
//    uint32_t                BaudRate;//模块串口出厂波特率
//    drv_usart_wordlen_e     WordLength;
//    drv_usart_stopbit_e     StopBits;
//    drv_usart_parity_e      Parity;
//    uint16_t                Rx_Priority;
//    uint32_t                buff_max;

//	/* ***************Private Method    *************** */
//	
//    /* ***************Public Method     *************** */
//	void (*ReadVer) (dev_bag302_t*, uint8_t*);
//	unsigned long (*ReadPre) (dev_bag302_t* );
//    uint8_t (*send) (dev_bag302_t*,uint8_t*, uint16_t); 
//    /* ***************Private Attributes*************** */

//};
/* Public Variable ---------------------------------------------------------*/

//Pointer

//Array

//Const

/* Pubilc function prototypes -----------------------------------------------*/
//int Dev_CDG025D_Init (dev_cdg025d_t*);
void BAG302ReadVer(void);
int BAG302AssembleSendCom(uint8_t *addr,uint8_t *p_dst);
int BAG302MastDecode(uint8_t *p_data, uint8_t len, uint16_t offset);
static void BAG302ComCallBack(uint8_t *data, uint32_t len);
uint32_t BAG302Com_send_data(uint8_t *data, uint32_t len);
void BAG302_handler(uint16_t timebase);
void BAG302_init(void);

void dev_bag302_test_send(void);

#endif /* __DEV_BAG302_H__ */
/******************* (C) COPYRIGHT 2023 Evan *****END OF FILE****/
